<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户员工访谈记录信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body>
           <form id="prj_cst_emp_Intv_rec_Info_buil_form">
             <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
		                      <div class="fieldBox col_50">
				                    <div class="label">名称</div>
				                    <div class="field">
				                        <input name="nm"   id="nm" type="text" class="ui-textbox" value="${prjCstEmpIntvRec.nm}"  validate="{required:true}">
				                       <span class="requiredSymbol">*</span>
				                    </div>
		               		 </div>
		               		 
		               		 	<div id="assRlCdDiv"  style="display: none">
	                            <div class="fieldBox col_50">
	                                <div class="label">与申请人关系</div>
	                                <div class="field">
	                                <select name="assRlCd"  id="assRlCd"   >
	                                <c:forEach items="${keyList}" var="opt">
	                                 <option value="${opt.key}"
	                                 <c:if test="${opt.key==prjCstEmpIntvRec.assRlCd }">selected="selected"</c:if>
	                                 >${opt.value}</option>
	                                </c:forEach>
	                                </select>
	                                </div>
	                            </div>
	                            </div>
	                            	<div class="fieldBox col_50">
	                                	<div class="label">联系方式</div>
		                                <div class="field">
		                              		<input name="tel" id="tel" type="text" class="ui-textbox" value="${prjCstEmpIntvRec.tel }"   validate="{required:true}">
		                                	 <span class="requiredSymbol">*</span>
		                                </div>
	                            	</div>
                            	
                            	<div id="postDiv"  style="display: none">
                            	 	<div class="fieldBox col_50">
                                	<div class="label"> 职务</div>
	                                <div class="field">
	                              		<input name="posCd" id="posCd" type="text" class="ui-textbox" value="${prjCstEmpIntvRec.posCd }" >
	                                </div>
                            		</div>
                            	</div>
                            	<div class="fieldBox col_100">
                                	<div class="label">访谈记录</div>
	                                <div class="field" style="width:90%">
                               		 <textarea name="commRec" id="commRec"  rows="4"  class="l-textarea" style="width:90%" >${prjCstEmpIntvRec.commRec}</textarea>
	                             	<span class="requiredSymbol">*</span>
                               		 </div>
                            	</div>
                           </div>
                            <div class="fieldBox col_100" style="display:none;">
								<div class="field">
								    <input name="recId"  id="recId" type="text" class="ui-textbox" value="${prjCstEmpIntvRec.id }" >
								</div>
							</div>
						  <div class="btnsBox">
				                <span id="prj_cst_emp_Intv_rec_add_btn_id" class="sq-button sq-button-round" onclick="save();"><!-- <i class="sqBtnIco_10"></i> -->保存</span>
				                <span id="prj_cst_emp_Intv_rec__cancel_btn_id" class="sq-button sq-button-round" onclick="cancelBtn();"><!-- <i class="sqBtnIco_14"></i> -->取消</span>
           				 </div>
                    </form>

<script type="text/javascript">
 var prjId = '${prjId}';
 var cstId = '${cstId}';
 var cstType = '${cstType}';
 var cstRlCd ='${cstRlCd}';
$(function () {
	initData();
});

	//初始化数据
	function initData(){
		$("#prj_cst_emp_Intv_rec_Info_buil_form").ligerForm({
		    validate: true
		});
	 	if(cstType==ProjectConstant.CST_TYP_CD_NP){
			$("#assRlCdDiv").show();
		} 
		if(cstType==ProjectConstant.CST_TYP_CD_LP){
			$("#postDiv").show();
		}
	}
	
	
	//取消
	function cancelBtn(){
		 parent.$.ligerDialog.close();
		 parent.$(".l-dialog,.l-window-mask").css("display","none"); 
	}
	function save(){
        var ligerForm = liger.get("prj_cst_emp_Intv_rec_Info_buil_form");
        if (!ligerForm.valid()) {
            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = ligerForm.getData();
        data['cstRlCd'] = cstRlCd;
        var url = '<%=path%>/project/prjcstempintvrec/add.do';
        var recId = $("#recId").val();
        data["id"]= recId;
        data["prjId"]= prjId;
        data["cstId"]= cstId;
        var wait_dialog;
        $.ajax({
    		type: 'post',
    		dataType:'json',
    		data:data,
    		url: url,
    		beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
    		success:function(msg){
    			 wait_dialog.close();
    			 if(msg.success == 1){
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
    				 parent.grid.reload();
    				 parent.$.ligerDialog.close();
    				parent.$(".l-dialog,.l-window-mask").css("display","none"); 
    			 }else{
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
    			 }
    		}
    	});
	}
    </script>
</body>
</html>